import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  // 教师模块
  {
    path: '/teacher',
    component: () => import('../layouts/TeacherLayout.vue'),
    children: [
      { path: 'profile', name: 'teacher-profile', component: () => import('../views/teacher/Profile.vue') },
      { path: 'add-topic', name: 'teacher-add-topic', component: () => import('../views/teacher/AddTopic.vue') },
      { path: 'topic-list', name: 'teacher-topic-list', component: () => import('../views/teacher/TopicList.vue'),
        children: [
          { path: 'approved', name: 'teacher-topic-list-approved', component: () => import('../views/teacher/checked.vue') },
          { path: 'pending', name: 'teacher-topic-list-pending', component: () => import('../views/teacher/unchecked.vue') }
        ]
      },
      { path: 'message', name: 'teacher-message', component: () => import('../views/teacher/Message.vue') },
      { path: 'progress', name: 'teacher-progress', component: () => import('../views/teacher/Progress.vue') }
    ]
  },
  // 学生模块
  {
    path: '/student',
    component: () => import('../layouts/StudentLayout.vue'),
    children: [
      { path: 'profile', name: 'student-profile', component: () => import('../views/student/Profile.vue') },
      { path: 'my-topic', name: 'student-my-topic', component: () => import('../views/student/MyTopic.vue') },
      { path: 'topic-select', name: 'student-topic-select', component: () => import('../views/student/TopicSelect.vue') },
      { path: 'message', name: 'student-message', component: () => import('../views/student/Message.vue') },
      { path: 'progress', name: 'student-progress', component: () => import('../views/student/Progress.vue') }
    ]
  },
  // 管理员模块
  {
    path: '/admin',
    component: () => import('../layouts/AdminLayout.vue'),
    children: [
      { path: 'profile', name: 'admin-profile', component: () => import('../views/admin/Profile.vue') },
      { path: 'student-list', name: 'admin-student-list', component: () => import('../views/admin/StudentList.vue') },
      { path: 'teacher-list', name: 'admin-teacher-list', component: () => import('../views/admin/TeacherList.vue') },
      { path: 'topic-list', name: 'admin-topic-list', component: () => import('../views/admin/TopicList.vue') },
      { path: 'message', name: 'admin-message', component: () => import('../views/admin/Message.vue') },
      { path: 'user-list', name: 'admin-user-list', component: () => import('../views/admin/UserList.vue') }
    ]
  },
  // 登录页
  { path: '/login', name: 'login', component: () => import('../views/LoginView.vue') },
  // 注册页
  { path: '/register', name: 'register', component: () => import('../views/RegisterView.vue') },
  // 默认重定向
  { path: '/', redirect: '/login' }
]
const router = createRouter({
  history: createWebHistory(),
  routes
})


export default router
